package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wxsearch.SearchIndexVO;
import com.cskaoyan.service.WXSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 小程序搜索功能
 * @Author: 徐能雄
 * @Date: 2021/9/18 15:03
 */
@RestController
@RequestMapping("wx")
public class WXSearchController {

    @Autowired
    WXSearchService wxSearchService;

    @GetMapping("search/index")
    BaseRespVo searchIndex() {
        SearchIndexVO searchIndex = wxSearchService.searchIndex();
        return BaseRespVo.ok(searchIndex);
    }

    @GetMapping("search/helper")
    BaseRespVo searchHelper(String keyword) {
        BaseRespVo baseRespVo = wxSearchService.searchHelper(keyword);
        return baseRespVo;
    }

    @PostMapping("search/clearhistory")
    BaseRespVo searchClearhistory() {
        BaseRespVo baseRespVo = wxSearchService.searchClearhistory();
        return baseRespVo;
    }
}
